local thbattle__qinxin_anhei = fk.CreateSkill {

  name = "thbattle__qinxin_anhei",

  tags = {},

}



thbattle__qinxin_anhei:addEffect("active", {
  prompt = "#thbattle__qinxin_anhei",
  anim_type = "control",
  card_num = 1,
  card_filter = function(self, player, to_select, selected)
    return #selected < 1 and Fk:getCardById(to_select).color == Card.Black
  end,
  target_num = 1,
  target_filter = function(self, player, to_select, selected, selected_cards, card, extra_data)
    return #selected < 1 and to_select ~= player and to_select.hp >= player.hp
  end,
  max_phase_use_time = 1,
  on_use = function(self, room, effect)
    local player = effect.from
    local target_id = effect.tos[1]
    local target_card = effect.cards[1]
    if #target_id:getCardIds("h") >= target_id.hp then
      local n = #target_id:getCardIds("h") - target_id.hp + 1
      local cards=room:askToCards(target_id,{
        max_num=n,
        min_num=n,
        pattern=".|.|.|hand",
        skill_name=thbattle__qinxin_anhei.name,
        prompt="#thbattle__qinxin_anhei-discard:::" .. n
      })
      room:throwCard(cards,thbattle__qinxin_anhei.name,target_id,player)
    end
    room:obtainCard(target_id, target_card, true, fk.ReasonGive, player, thbattle__qinxin_anhei.name, "@@thb_mingpai")
  end,
})

return thbattle__qinxin_anhei
